#define  _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int dominantIndex(int* nums, int numsSize) {
    int max1 = 0;
    int max2 = 0;
    for (size_t i = 1; i < numsSize; i++)
    {
        if (nums[i] > nums[max1])
        {
            max1 = i;
        }
    }
    for (size_t i = 1; i < numsSize; i++)
    {
        if (max1 != i && nums[i] > nums[max2])
        {
            max2 = i;
        }
    }
    if (nums[max1] >= 2 * nums[max2])
    {
        return max1;
    }
    return -1;
}

int main()
{
    int arr[] = { 3,6,1,0 };
    int ret = dominantIndex(arr, sizeof(arr) / sizeof(int));
    printf("%d ", ret);
	return 0;
}